import { $put, $get, $post, $uploadImg, $upload } from '../utils/request'

// 生成小商铺链接
export const GENERATE_SHOP_URL = params =>
  $put('/store-platform/shop/buildShopUrl', null, params)

// 查询小商铺链接
export const FIND_SHOP_URL = params =>
  $get('/store-platform/shop/findShopUrl', params)

// 查询商铺配置申请详情接口
export const FIND_SHOP_APPLY_INFO = shopId =>
  $get('/store-platform/shopConfig/findApplyInfoApi', { shopId })

// 申请更改商铺配置信息接口
export const SEND_SHOP_APPLY = params =>
  $post('/store-platform/shopConfig/applyApi', params)

// 根据身份证查询通联商户号接口
export const FIND_MER_ID_BY_ID_CARD = idCard =>
  $get('/store-platform/scan/tlMerIds', { idCard })

// 开通支付
export const OPEN_PAYMENT = params =>
  $put('/store-platform/shop/openPay', params)

// 创建商户
export const GENERATE_NEW_MER = params =>
  $post('/store-platform/scan/createMerInfo', null, params)

// 生成店铺二维码(换logo)
export const UPDATE_SHOP_QR_LOGO = url =>
  $uploadImg('/store-platform/qrCode/buildQRCode', 'logo', { url })

// 上传图片
export const UPLOAD_IMAGE = filePath =>
  $upload('/store-platform/upload-image', filePath, 'picFile', {
    picType: 'NORMAL',
    catalog: 'xiaochengxu'
  })

// 上传店铺LOGO
export const UPLOAD_SHOP_LOGO = () =>
  $uploadImg('/store-platform/upload-image', 'picFile', {
    picType: 'NORMAL',
    catalog: 'xiaochengxu'
  })

// 生成小商铺链接
export const NEW_GENERATE_SHOP_URL = (shopId, isOffline) =>
  $put(
    `/store-platform/shop/buildShopUrl?shopId=${shopId}&isOffline=${isOffline}`
  )
